

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_ExclusiveOr_RT : RT_Node
    {
        public RT_SingleValuePort Boolean1_RT;

        public RT_SingleValuePort Boolean2_RT;

        public RT_SingleValuePort Result_RT;

        public Node_ExclusiveOr_RT(Node_ExclusiveOr sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            Boolean1_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.Boolean1, this);

            Boolean2_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.Boolean2, this);

            Result_RT = new RT_SingleValuePort(EPortIOType.Output, sourceData.Result, this);
            Result_RT.OnGetValue = GetResult;
        }

        public AValue GetResult(DAG_Executor executor)
        {
            bool b1 = Boolean1_RT.GetValue(executor).ToBoolean().Item2;
            bool b2 = Boolean2_RT.GetValue(executor).ToBoolean().Item2;
            bool result = b1 != b2;
            Result_RT.SourceValue.SetBoolean(result);
            return Result_RT.SourceValue;
        }
    }
}